/* Base Styles */
:root {
  --background: #f8fafc;
  --foreground: #1e293b;
  --gray-100: rgba(30, 41, 59, 0.05);
  --gray-200: rgba(30, 41, 59, 0.1);
  --gray-300: rgba(30, 41, 59, 0.2);
  --gray-400: rgba(30, 41, 59, 0.3);
  --gray-500: rgba(30, 41, 59, 0.4);
  --gray-600: rgba(30, 41, 59, 0.6);
  --gray-700: rgba(30, 41, 59, 0.7);
  --gray-800: rgba(30, 41, 59, 0.8);
  --gray-900: rgba(30, 41, 59, 0.9);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-pre-hover: #98b3ec;
  --green: #10b981;
  --red: #ef4444;
  --border-color: rgba(30, 41, 59, 0.1);
  --bg-color: rgba(243, 245, 247, 0.8);
  --card-bg: #ffffff;
  --card-hover: #ffffff;
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  --radius: 0.5rem;
  --grid-columns: 200px;
  --bg-img: '';
}

body {
  background-color: var(--background);
  color: var(--foreground);
}

.dark-theme {
  --background: #0f172a;
  --foreground: #ffffff;
  --gray-100: rgba(255, 255, 255, 0.1);
  --gray-200: rgba(255, 255, 255, 0.2);
  --gray-300: rgba(255, 255, 255, 0.3);
  --gray-400: rgba(255, 255, 255, 0.4);
  --gray-500: rgba(255, 255, 255, 0.5);
  --gray-600: rgba(255, 255, 255, 0.6);
  --gray-700: rgba(255, 255, 255, 0.7);
  --gray-800: rgba(255, 255, 255, 0.8);
  --gray-900: rgba(255, 255, 255, 0.9);
  --border-color: rgba(255, 255, 255, 0.1);
  --bg-color: rgba(30, 41, 59, 0.1);
  --card-bg: rgba(15, 23, 42, 0.6);
  --card-hover: rgba(15, 23, 42, 0.8);
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  --nav-btn-color: white;
  --primary: #6dc0f5;
  --primary-hover: #6b94ec;
  --primary-pre-hover: #98b3ec;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  overflow-x: hidden;
  /* 背景图垂直、水平均居中 */
  background-position: center center;
  /* 背景图不平铺 */
  background-repeat: no-repeat;
  /* 当内容高度大于图片高度时，背景图像的位置相对于viewport固定 */
  background-attachment: fixed;
  /* 让背景图基于容器大小伸缩 */
  background-size: cover;
  /* 设置背景颜色，背景图加载过程中会显示背景色 */
  background-color: #464646;
  /* background-image: linear-gradient(to bottom, rgba(59, 130, 246, 0.15), rgba(99, 102, 241, 0.15)), url("https://staticedu-wps.cache.iciba.com/image/773c095d340514e53dd71052f38b5503.png"); */
}

body:before {
  background: radial-gradient(circle at 50% 50%, rgba(96, 165, 250, .2), transparent 50%), radial-gradient(circle at 80% 20%, rgba(59, 130, 246, .3), transparent 35%), radial-gradient(circle at 20% 80%, rgba(236, 72, 153, .3), transparent 35%), radial-gradient(circle at 0 0, rgba(99, 102, 241, .25), transparent 30%), radial-gradient(circle at 100% 100%, rgba(192, 38, 211, .25), transparent 30%);
  filter: blur(32px);
  z-index: -2;
  animation: pulse 8s ease-in-out infinite;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Particle Background */
.particle-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.3;
  pointer-events: none;
  filter: contrast(1.2) brightness(1.1);
}

/* 视图模式按钮组 */
.view-mode-buttons {
  display: flex;
  gap: 0.5rem;
}

.view-mode-buttons .btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  border-radius: var(--radius);
  background-color: var(--bg-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-mode-buttons .btn-sm:hover {
  background-color: var(--gray-200);
}

.view-mode-buttons .btn-sm.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Header */
.header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-color);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(30, 41, 59, 0.05);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--gray-300);
  margin-right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--gray-100);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 1.125rem;
  font-weight: 500;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 0.5rem;
  margin-right: 0.5rem;
  margin-top: 0.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
  color: var(--foreground);
}

.btn .icon {
  margin-right: 0rem;
}

.btn-danger {
  color: rgb(239, 68, 68);
}

.btn-danger:hover {
  color: red;
  background-color: var(--gray-100);
}

.btn-ghost {
  color: var(--gray-600);
  text-decoration: none;
}

.btn-ghost:hover {
  color: rgb(239, 68, 68);
  background-color: var(--gray-100);
}

.btn-outline {
  border: 1px solid var(--gray-300);
  background-color: var(--primary);
  color: var(--background);
}

.btn-outline .icon {
  color: var(--background);
}

.btn-outline:hover {
  background-color: var(--primary-hover);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.header-right .btn {
  margin-left: 0.5rem;
}

/* Main Content */
.main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Search Section */
.search-section {
  margin-bottom: 2rem;
}

.search-container {
  max-width: 800px;
  margin: 0 auto;
}

.clock {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.light-theme .clock {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);

  .time {
    font-size: 3rem;
    font-weight: 300;
    color: var(--foreground);
    margin-bottom: 0.25rem;
  }

  .date {
    font-size: 1rem;
    color: var(--gray-600);
  }

  border-radius: var(--radius);
  background-color: rgba(250, 250, 250, 0.3);
  backdrop-filter: blur(4px);
  color: var(--foreground);
}

.clock .time {
  font-size: 3rem;
  font-weight: 300;
  margin-bottom: 0.25rem;
}

.clock .date {
  font-size: 1rem;
  color: var(--gray-400);
}

.search-box {
  display: flex;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background-color: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  /* overflow: hidden; */
  margin-bottom: 1rem;
}

.search-type {
  display: flex;
  align-items: center;
  border-right: 1px solid var(--gray-300);
  position: relative;
}

.search-type-btn {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  height: 100%;
  background: none;
  border: none;
  color: var(--gray-600);
  cursor: pointer;
}

.dropdown-arrow {
  margin-left: 0.25rem;
}

.search-type-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 120px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 1000;
  margin-top: 5px;
  backdrop-filter: blur(8px);
}

.search-type-dropdown.active {
  display: block;
}

.dark-theme .search-type-dropdown {
  background-color: rgba(15, 23, 42, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
}

.light-theme .search-type-dropdown {
  background-color: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.1);
}

.search-type-option {
  padding: 0.5rem 1rem;
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 4px;
  margin: 2px 4px;
}

.search-type-option:hover {
  background-color: var(--gray-200);
}

.dark-theme .search-type-option:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.light-theme .search-type-option:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.search-input {
  flex: 1;
  height: 48px;
  padding: 0 1rem;
  border: none;
  background: transparent;
  color: var(--foreground);
  font-size: 1rem;
  outline: none;
}

.search-input::placeholder {
  color: var(--gray-500);
}

.search-btn {
  padding: 0 1.5rem;
  height: 48px;
  background-color: var(--gray-200);
  border: none;
  color: var(--foreground);
  cursor: pointer;
  transition: background-color 0.2s;
}

.search-btn:hover {
  background-color: var(--gray-300);
}

.category-group {
  margin-bottom: 1rem;
}

#tools-container {
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-columns), 1fr));
  gap: 1rem;
}

.category-tools {
  display: contents;
}

.no-results {
  text-align: center;
  margin-top: 2rem;
  font-size: 2rem;
  color: var(--gray-500);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.favorites-section {
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.favorites-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 1rem;
}

.favorites-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.category-tab {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  background: none;
  border: none;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
}

.category-tab:hover {
  color: var(--foreground);
  background-color: var(--gray-100);
}

.category-tab.active {
  background-color: var(--primary);
  color: white;
}

/* Hero Section */
.hero-section {
  text-align: center;
  margin: 3rem 0;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--gray-600);
  max-width: 800px;
  margin: 0 auto;
}

/* 
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background-color: var(--background);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
} */

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-600);
  cursor: pointer;
}

.modal-body {
  padding: 1rem;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 0 1rem;
  }

  .header-right .btn span {
    display: none;
  }

  .hero-title {
    font-size: 2rem;
  }

  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

@media (max-width: 480px) {
  .search-type {
    display: none;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }
}


.category-group {
  margin-bottom: 2rem;
}

.category-title {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 1rem;
  color: var(--foreground);
  padding-left: 0.5rem;
  border-left: 3px solid var(--primary);
  display: flex;
}

.category-share {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-left: 1rem;
}

.category-download {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--grid-columns), 1fr));
  gap: 1rem;
}

body.light-theme {
  background-color: #f8fafc;
}

select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background-color: var(--card-bg);
  color: var(--foreground);
  font-size: 1rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}

select:hover {
  border-color: var(--gray-300);
}

select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-hover);
}

.dark-theme select {
  background-color: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark-theme select:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.dark-theme select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.light-theme .tool-card {
  background-color: #ffffff;
  border-color: #e5e7eb;
  color: #1f2937;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.light-theme .tool-title {
  color: #1f2937;
}

.light-theme .tool-description {
  color: #6b7280;
}

.light-theme .tool-status {
  color: #1f2937;
}

.light-theme .tool-stats {
  color: #6b7280;
}

.light-theme .tool-category {
  color: #6b7280;
}

.light-theme .delete-tool-btn {
  background-color: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.6);
}

.light-theme .delete-tool-btn:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: rgb(239, 68, 68);
}

.light-theme .hero-title {
  color: #1e293b;
}

.light-theme .hero-subtitle {
  color: #64748b;
}

.add-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 20px;
  margin-bottom: 20px;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.3s ease;
}

.add-tool-btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.8);
}

.light-theme .add-tool-btn {
  border: 2px dashed rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.5);
}

.light-theme .add-tool-btn:hover {
  border-color: rgba(0, 0, 0, 0.2);
  color: rgba(0, 0, 0, 0.7);
}

body.dark-theme {
  background-color: #0f172a;
  background-image: linear-gradient(to bottom, #0f172a, #1e293b);
}

.dark-theme .tool-card {
  background-color: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.dark-theme .tool-card:hover {
  background-color: rgba(15, 23, 42, 0.8);
}

.delete-tool-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}



.light-theme .btn-ghost {
  color: #64748b;
}

.light-theme .btn-ghost:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: rgb(239, 68, 68);
}

.light-theme .particle-background {
  opacity: 0.3;
}

.dark-theme .particle-background {
  opacity: 0.6;
}

.light-theme .search-box {
  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.light-theme .search-input {
  color: #1e293b;
}

.light-theme .search-input::placeholder {
  color: #94a3b8;
}

.light-theme .search-btn {
  background-color: #3b82f6;
  color: #ffffff;
}

.light-theme .search-type-btn {
  color: #64748b;
}

.light-theme .category-tab {
  background-color: rgba(0, 0, 0, 0.05);
  color: #64748b;
}

.light-theme .category-tab.active {
  background-color: #3b82f6;
  color: #ffffff;
}

.tool-card:hover .delete-tool-btn {
  display: flex;
}

.delete-tool-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: rgb(239, 68, 68);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
}

.category-modal-content {
  width: 50%;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: rgb(17, 24, 39);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.light-theme .modal-content {
  background: #ffffff;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.light-theme .modal h2 {
  color: #1e293b;
}

.light-theme .form-group label {
  color: #64748b;
}

.light-theme .form-group input,
.light-theme .form-group textarea {
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.02);
  color: #1e293b;
}

.modal h2 {
  margin: 0 0 20px;
  color: rgba(255, 255, 255, 0.9);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.6);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.tool-card {
  position: relative;
}